package com.example.javatestdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Field f1 = new Field("tony", 19);
        Field f2 = new Field("jack", 16);
        Field f3 = new Field("tom", 80);
        Field f4 = new Field("jbson", 44);
        Field f5 = new Field("jason", 44);

        List<Field> list = new ArrayList<>();
        list.add(f1);
        list.add(f3);
        list.add(f4);
        list.add(f2);
        list.add(f5);
        Collections.sort(list);

        for (Field o : list) {
            Log.e("MainActivity",o.getAge() + "-->" + o.getName());
        }


    }
}
